﻿using System;
using Messages;
using Rhino.ServiceBus;
using Rhino.ServiceBus.Hosting;
using Utils;
using Rhino.ServiceBus;

namespace FirstSub
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue.PrepareQueue("client_1");

            var host = new DefaultHost();
            host.Start<BootStrapper>();

            var exit = "";
            
            while (!exit.Equals("q")) 
            {
                Console.WriteLine("Type thing that you want to buy from coffee shop:");
                var Message = Console.ReadLine();

                var bus = host.Bus as IServiceBus;

                bus.Send(new Message_Type1
                {
                    Text = Message,
                    Id = 1
                });

                exit = Console.ReadLine();
            }
        }
    }

    public class MessageIntercept : ConsumerOf<Message_Type2>
    {
        public void Consume(Message_Type2 message)
        {
            Console.WriteLine(message.Text);
        }
    }
}
